UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwDlnJIR/HaU49po+3g3byO8Lx4BSq+lAaofAfo84bc=' 
WHERE 
  key_id = 'e6a988f6beb2edf55b237ec51b233240eb3a4344f388ccd3e2bf8f4ac83d61c2' 
  AND (
    token = 'AwDlnJIR/HaU49po+3g3byO8Lx4BSq+lAaofAfo84bc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030