UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ao7/4HJ1ySlOmgS0rRdjHLbceU+IHAYWxspPf3NjSHw=' 
WHERE 
  key_id = 'e6047f2cb03be45c59d20fdb17101b49c76a6a04532043d4a6c92084916158b9' 
  AND (
    token = 'ao7/4HJ1ySlOmgS0rRdjHLbceU+IHAYWxspPf3NjSHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086