UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pBf1jWsn84AuRRHq7WpTnXXlkrcnYpLZsUD98wBaVX8='
WHERE
key_id = '1f976eef2c54d1de50f28a845fbd150d362b023c8c3e514a7ee37133b0163e0b'
AND (
token = 'pBf1jWsn84AuRRHq7WpTnXXlkrcnYpLZsUD98wBaVX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)