UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bPdj2YZqXSUbCqLNvdIZ7b0D8O7CR+Dt6QqDX5NALIU='
WHERE
key_id = '4df6aaa4191c98c47d8af7209cc7dee3edbec7af0d8268ba288389a9cc90673c'
AND (
token = 'bPdj2YZqXSUbCqLNvdIZ7b0D8O7CR+Dt6QqDX5NALIU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)