UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a5ifBlwM9zNQLOJ+FI4SYRkT/gbvo1TegUzxc5SL9dI='
WHERE
key_id = 'd598f6184315198c2674aa06f5350f25597fa4036fa97e13b84dcf46e76916cd'
AND (
token = 'a5ifBlwM9zNQLOJ+FI4SYRkT/gbvo1TegUzxc5SL9dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)