UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D8ksou7R/OSZ6mkT/1YIIBmyNB5rULrtJZ2mPYVKWK4='
WHERE
key_id = '571ce500dd99f8ffb258983cd0d062be5d4eed6ed0d8519de915c2876fe9a347'
AND (
token = 'D8ksou7R/OSZ6mkT/1YIIBmyNB5rULrtJZ2mPYVKWK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)