UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaDQUX7782GvS/ourpxzoPOMUtwXngELJ677OOgYsks='
WHERE
key_id = 'f34e22c4f3e6cd5e817865ea71b130859a1805fccb09bca10c46e7327f2101b4'
AND (
token = 'NaDQUX7782GvS/ourpxzoPOMUtwXngELJ677OOgYsks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)