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