UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nhJd4DmkTZXIsdMM2wi6n/j0SFixymCJWYlkSEFwFNw='
WHERE
key_id = 'c5a8ed990648c69689a2ae217602bc1f0cff167551262da4eb4960df8a54ee1f'
AND (
token = 'nhJd4DmkTZXIsdMM2wi6n/j0SFixymCJWYlkSEFwFNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)