UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IrynQyGWB1BkaEYIR4o5pINQu22+7Ctm8pCl9od3+UA='
WHERE
key_id = 'e1d433af77edf3117091b6c85fef49a7ef0bfcbbd1f59450f44b006810331c3a'
AND (
token = 'IrynQyGWB1BkaEYIR4o5pINQu22+7Ctm8pCl9od3+UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)