UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Khd+zbxAs8DZBZFFPHbZRwFn7CnycMyJt+pCJq1DPm8=' 
WHERE 
  key_id = '321db0fb84c29ce33c61de9ef4f2b744dc571678b3f1108e7b4bc241163dfdfd' 
  AND (
    token = 'Khd+zbxAs8DZBZFFPHbZRwFn7CnycMyJt+pCJq1DPm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030