UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mnRHDSV2r4J+gyWP4OX4Np1br5kiCZN7s6iFjD2baAc='
WHERE
key_id = '82ca776afabd96e5d419a666210d8d602de3d9bbe0e85e184f41e1df4e454aff'
AND (
token = 'mnRHDSV2r4J+gyWP4OX4Np1br5kiCZN7s6iFjD2baAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)