UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MYFhH8vFxPf3V4KDj4ovMh0HjqpeI1Ih6E+vurJnlPY=' 
WHERE 
  key_id = '74f43bd4b54a09d5393cac1badc1486e04849a4286a22cad681e847bb08f8ff3' 
  AND (
    token = 'MYFhH8vFxPf3V4KDj4ovMh0HjqpeI1Ih6E+vurJnlPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045