UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CEx05d2vA8OJ2e5EmBZ91Ol5k3gAMYZJUDQHFwGX1VM=' 
WHERE 
  key_id = 'b80ae2e1fda409a1c63def0e04d5b6c2f4ee328360f2da432601cc6d6776f530' 
  AND (
    token = 'CEx05d2vA8OJ2e5EmBZ91Ol5k3gAMYZJUDQHFwGX1VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054