UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0PPsoYBsvUpqSO1+rB80wX4KMPWJp1F8y1wawM+dC8=' 
WHERE 
  key_id = '76957dfb923a4398938e1e0f8fc53542ec0639f121cb466add7e9cff2553bd60' 
  AND (
    token = 'q0PPsoYBsvUpqSO1+rB80wX4KMPWJp1F8y1wawM+dC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029