UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SPphqDAvktCNQwoii+PyH5w5EsLlPnkac1WA+GTs6V4='
WHERE
key_id = '3a42899179e7b23e2a3b5d4576334d0b127962cc65515a284af9874d4a03c670'
AND (
token = 'SPphqDAvktCNQwoii+PyH5w5EsLlPnkac1WA+GTs6V4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)