UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3aWOjRrMxriuGg/35rLBcjk+trNL58Amor34dxoey18=' 
WHERE 
  key_id = 'd76f64f0c98b94b8be249b13164aaac5f92d760b62701a92edd966e10277f33d' 
  AND (
    token = '3aWOjRrMxriuGg/35rLBcjk+trNL58Amor34dxoey18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045