UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YWaK5lM6AswvYjPMWIw7I88olxZIoevSXDDi58wADiI='
WHERE
key_id = '7eb7ad012449f097c3671332a6f9b366f24687a0b0f09b979819d0a132556385'
AND (
token = 'YWaK5lM6AswvYjPMWIw7I88olxZIoevSXDDi58wADiI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)