UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L6waermhCW33PV5TNmuTksLvgrvy9u9SlzEvdZXTl+A=' 
WHERE 
  key_id = 'e1e4c8117f8d4db4bdb80d7498d72b515bb8d408c4cdb4714cfedbdb224241bf' 
  AND (
    token = 'L6waermhCW33PV5TNmuTksLvgrvy9u9SlzEvdZXTl+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032