UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pMRkWjTFrDDUy5ffQnRyfO6QOj6qlprE5CdPs5hA2+8='
WHERE
key_id = 'c81ee2ca54c2329846178dccad736973b766fa982dd74a9bbb29e5d32d587fea'
AND (
token = 'pMRkWjTFrDDUy5ffQnRyfO6QOj6qlprE5CdPs5hA2+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)