UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lrPAdqy5d8FYpVX9+9+67+LX3gubMJBbZmR3Bswg3sk='
WHERE
key_id = 'b8830e62bb1d528be6271bae7276d59e965a7893ce6c88a1bd6c0ae64df8a696'
AND (
token = 'lrPAdqy5d8FYpVX9+9+67+LX3gubMJBbZmR3Bswg3sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)