UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GdRirzfY19yhw7qeYrDK7y1OOHZteESb7uPXiVLs5oo='
WHERE
key_id = '016c8a33f57307abfcf7dccf0c16b8373313f821d5be51dfb6a0065dcea3b51c'
AND (
token = 'GdRirzfY19yhw7qeYrDK7y1OOHZteESb7uPXiVLs5oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)