UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oEzgKYnNBHWa4bdLwDUZKqqqanszyr5FfWyRc3LlA3o='
WHERE
key_id = 'c6c0686917f2932089867f6ad7b40e43a7911dd03256384a39a3a75a17537f2f'
AND (
token = 'oEzgKYnNBHWa4bdLwDUZKqqqanszyr5FfWyRc3LlA3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)