UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fwalTCXWI6gEIPbZeJ0kaK90Oal3meN/D7/Wp9t0i/k=' 
WHERE 
  key_id = 'b0b08165365f7473e3e03a1631afa6c7f45553fbddfa4a4570f8e30dabbb00de' 
  AND (
    token = 'fwalTCXWI6gEIPbZeJ0kaK90Oal3meN/D7/Wp9t0i/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042