UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K3+elJfCTlXCTKraxOyhFrbmuETkacJhdBu1ZEi3hh4=' 
WHERE 
  key_id = '10183bbc1ee4a59736006aae9bc58d674671e5db1baf31608f9a1583a3d82f98' 
  AND (
    token = 'K3+elJfCTlXCTKraxOyhFrbmuETkacJhdBu1ZEi3hh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032