UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZ2ttGFuN80QPUPWrj+9EjQUVmqt8eyA0WuzpRqv0Og=' 
WHERE 
  key_id = '227b4c67a10acb55b9ab9f40db24aeedbfa1c7481151f5f0d0a645f4693be38c' 
  AND (
    token = 'gZ2ttGFuN80QPUPWrj+9EjQUVmqt8eyA0WuzpRqv0Og=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034