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

Query time 0.00032