UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IT8mp4ECKKKHgYIev21ynyPu8znrV7TXFJ4bqKzs0gM='
WHERE
key_id = 'bcc2d7f2f7ccce8b87e714816d143674de7fc081d7afcd279e70bde5e1409696'
AND (
token = 'IT8mp4ECKKKHgYIev21ynyPu8znrV7TXFJ4bqKzs0gM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)