UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cAGVGWhjf81LwYY8g2LejZbS4WPSHD5rWwKmw1BiZog='
WHERE
key_id = 'f233b2b3a234d25daba741cd3a3bc7a75a499f82aabeefce91dcd9da05fdd56e'
AND (
token = 'cAGVGWhjf81LwYY8g2LejZbS4WPSHD5rWwKmw1BiZog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)