UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0dxI7kS6x/LykwGV/12U5dOqJWjgsktdunF0LFaovdk=' 
WHERE 
  key_id = 'a696d823edb96d48f9d2e211c81783d8ab95c3e0e0d3e9bb725c21a567a6e18a' 
  AND (
    token = '0dxI7kS6x/LykwGV/12U5dOqJWjgsktdunF0LFaovdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039