UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HfKjTV3e7h7NtfL9IdWaHUw72QnCXaRi+5nYeBBpXP0='
WHERE
key_id = 'ad76114d240a9512a0424d94ec95fb25d0fe94364f4ec7ceab8eb74106216ebb'
AND (
token = 'HfKjTV3e7h7NtfL9IdWaHUw72QnCXaRi+5nYeBBpXP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)