UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2R3r/pGlgF9TlzNOxG5fkgACqyb+QCwaD/McqazpYI='
WHERE
key_id = 'cf9b4146f8ec436e15431137f496c93f672b1bf249fadc9059957f964937296f'
AND (
token = 'Z2R3r/pGlgF9TlzNOxG5fkgACqyb+QCwaD/McqazpYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)