UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D03l4teACLMzJnQk5+vyb3teNUmvel/JyD0LuJWT+EU=' 
WHERE 
  key_id = 'e07fad01cc1ca1979cb1466658593a9c749a78a4d68eae65b02ea09ecc457566' 
  AND (
    token = 'D03l4teACLMzJnQk5+vyb3teNUmvel/JyD0LuJWT+EU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033