UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OOon4f0wtI+m5XkeHxcZbOgyAA7osNmZjWCadeMhw+o='
WHERE
key_id = '6eb7b07219599577a793337432a7a78deaf465f41fe34b353f3886de8d2c9b1b'
AND (
token = 'OOon4f0wtI+m5XkeHxcZbOgyAA7osNmZjWCadeMhw+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)