UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7xZYosCiqpjBNXjSno3NFjuQ4ShFUmjGYCWXBXRh0g='
WHERE
key_id = '6e4f08715d526884f4f5cacdfa2adc16e7ca2a6b13e4870c164d0e89c3e6a8e9'
AND (
token = 'A7xZYosCiqpjBNXjSno3NFjuQ4ShFUmjGYCWXBXRh0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)